package com.coderside.fragment.thread;

public class TextThread {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
//		TxtThread tt = new TxtThread();
//		new Thread(tt).start();
//		new Thread(tt).start();
//		new Thread(tt).start();
//		new Thread(tt).start();
		System.out.println((char)66);
	}

}

class TxtThread implements Runnable {
	int num = 100;
	String str = new String();

	public void run() {
		while (true) {
			synchronized (this) {
				if (num > 0) {
					try {
						Thread.sleep(10);
					} catch (Exception e) {
						e.getMessage();
					}
					System.out.println(Thread.currentThread().getName()
							+ "this is " + num--);
				}
				if (num == 0) {
					break;
				}
			}
		}
	}
}